# 创建标签参数化数据https://zhuanlan.zhihu.com/p/335046281
import faker

createDatas = [
    {
        "ids": "参数ui",
        "data": {
            "tagname": "ui",
            "tagid": "12"
        },
        "response":
            {
                "code": "2"
            }
    }

]


def getDatas():
    """
    返回数据格式：[{
        "ids": "传入不存在的orderCode", #测试点名称
        "data": {   #请求数据
            "orderCodeList": [ #参数
                "OP0902287350311",
                "OP0902287350331"
            ]
        },
        "response": { #响应断言数据
            "retCode": 0,
            "msg": "未查询到数据!"
        }

    }]
    """
    # 测试点名称
    ids = ["传入正确的tagname和tagid"]
    # 查询明细数据集
    querydetaildatas = []
    for id in ids:
        # 查询明细数据
        querydetaildata = {}
        # 请求参数
        data = {}
        # 响应断言参数
        response = {}

        # 根据测试点名称设置请求数据及响应断言数据
        if id == "传入正确的tagname和tagid":
            data["tagname"] = "java1"
            data["tagid"] = "21"
            response["code"] = 1


        querydetaildata["ids"] = id
        querydetaildata["data"] = data
        querydetaildata["response"] = response
        querydetaildatas.append(querydetaildata)

    return querydetaildatas


if __name__ == '__main__':
    print(createDatas[0]["requests"]["data"])
